package com.xintouyun.medicine.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xintouyun.medicine.entity.Consignee;
import com.xintouyun.medicine.entity.User;
import com.xintouyun.medicine.service.AddressService;
import com.xintouyun.medicine.service.impl.AddressServiceImpl;
@WebServlet("/AddressQueryServlet")
public class AddressQueryServlet extends HttpServlet{
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("loginUser");
		
		AddressService addressService = new AddressServiceImpl();
		List<Consignee> list = addressService.list(user.getUid());
		
		request.setAttribute("data", list);
		
		request.getRequestDispatcher("member-setting-address.jsp").forward(request, response);
		
		
		
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);	
	}
}
